package cn.edu.java.stream.functionalinterface;

import java.util.function.Supplier;

public class SupplierDemo {
    public static void main(String[] args) {
        Supplier<String> supplier1 = new Supplier<String>() {
            @Override
            public String get() {
                return "Hello, World!";
            }
        };

        String result1 = supplier1.get();
        System.out.println(result1);

        // 使用Lambda表达式
        Supplier<String> supplier2 = () -> "Hello, World!";

        String result2 = supplier2.get();
        System.out.println(result2);
    }
}

